using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

/// <summary>
/// 设备类型的点检项目
/// </summary>
[Tenant(TPMConst.TPMConfigId)]
[SugarTable("CheckupItemTPMCategory", "设备类型的点检项目")]
public class CheckupItemTPMCategory
{
    /// <summary>
    /// 序号
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "序号", IsPrimaryKey = true)]
    public Guid Id { get; set; }

    /// <summary>
    /// 设备类型
    /// </summary>
    [SugarColumn(ColumnName = "TPMCategoryId", ColumnDescription = "设备类型")]
    public Guid TPMCategoryId { get; set; }

    /// <summary>
    /// TPM设备分组
    /// </summary>
    [SugarColumn(ColumnName = "TPMDeviceGroupId", ColumnDescription = "TPM设备分组")]
    public Guid TPMDeviceGroupId { get; set; }

    /// <summary>
    /// 点检周期
    /// </summary>
    [SugarColumn(ColumnName = "CheckupCycle", ColumnDescription = "点检周期")]
    public Guid CheckupCycle { get; set; }

    /// <summary>
    /// 步骤序号
    /// </summary>
    [SugarColumn(ColumnName = "ItemOrder", ColumnDescription = "步骤序号")]
    public int ItemOrder { get; set; }

    /// <summary>
    /// 点检项目名称
    /// </summary>
    [SugarColumn(ColumnName = "ItemName", ColumnDescription = "点检项目名称", Length = 100)]
    [Required, MaxLength(100)]
    public string ItemName { get; set; } = string.Empty;

    /// <summary>
    /// 点检对象
    /// </summary>
    [SugarColumn(ColumnName = "ItemObjects", ColumnDescription = "点检对象", Length = 200)]
    [Required, MaxLength(200)]
    public string ItemObjects { get; set; } = string.Empty;

    /// <summary>
    /// 点检内容
    /// </summary>
    [SugarColumn(ColumnName = "Content", ColumnDescription = "点检内容", Length = 2000)]
    [Required, MaxLength(2000)]
    public string Content { get; set; } = string.Empty;

    /// <summary>
    /// 检查方法
    /// </summary>
    [SugarColumn(ColumnName = "Method", ColumnDescription = "检查方法", Length = 200)]
    [Required, MaxLength(200)]
    public string Method { get; set; } = string.Empty;

    /// <summary>
    /// 合格标准
    /// </summary>
    [SugarColumn(ColumnName = "EligibilityCriteria", ColumnDescription = "合格标准", Length = 500)]
    [Required, MaxLength(500)]
    public string EligibilityCriteria { get; set; } = string.Empty;

    /// <summary>
    /// 是否记录参数值
    /// </summary>
    [SugarColumn(ColumnName = "IsParamValue", ColumnDescription = "是否记录参数值")]
    public bool? IsParamValue { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 200)]
    [MaxLength(200)]
    public string? Remark { get; set; }

    /// <summary>
    /// 创建用户
    /// </summary>
    [SugarColumn(ColumnName = "CreateUser", ColumnDescription = "创建用户", Length = 20)]
    [Required, MaxLength(20)]
    public string CreateUser { get; set; } = string.Empty;

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "创建时间")]
    public DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [SugarColumn(ColumnName = "UpdateUser", ColumnDescription = "更新用户", Length = 20)]
    [MaxLength(20)]
    public string? UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTime", ColumnDescription = "更新时间")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// TPMCategoryId (设备类型) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(TPMCategoryId), nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_TPMCategoryId { get; set; }

    /// <summary>
    /// TPMDeviceGroupId (TPM设备分组) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(TPMDeviceGroupId), nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_TPMDeviceGroupId { get; set; }

    /// <summary>
    /// CheckupCycle (点检周期) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CheckupCycle), nameof(SysDictDetail.Id))]//多对一
    public SysDictDetail sysDictDetail_CheckupCycle { get; set; }

    /// <summary>
    /// CreateUser (创建用户) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(CreateUser), nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_CreateUser { get; set; }

    /// <summary>
    /// UpdateUser (更新用户) 对应的外键实体
    /// </summary>
    [Navigate(NavigateType.ManyToOne, nameof(UpdateUser), nameof(T_USER.UserName))]//多对一
    public T_USER t__USER_UpdateUser { get; set; }

    /// <summary>
    /// 子表：点检记录详情
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(CheckupDetail.CheckupItemId))]//一对多
    public List<CheckupDetail> CheckupDetails { get; set; }
}